import java.io.*;
import java.net.*;

public class EchoClient {
    public static void main(String[] args) throws IOException {

        Socket echoSocket = null;
        PrintWriter out = null;
        BufferedReader in = null;
		String host = "localhost";
		int port = 4444;

        try {
            echoSocket = new Socket(host, port);
            out = new PrintWriter(echoSocket.getOutputStream(), true);
			in = new BufferedReader(new InputStreamReader(System.in));			
        } catch (UnknownHostException e) {
            System.err.println("Don't know about host: .");
            System.exit(1);
        } catch (IOException e) {
            System.err.println("Couldn't get I/O for "
                               + "the connection to: taranis.");
            System.exit(1);
        }


	String input;
	String prompt = "Type something:  ";

	System.out.print(prompt);
	while ((input = in.readLine()) != null) {
		System.out.print(prompt);
	    out.println(input);
	}

	out.close();
	in.close();
	echoSocket.close();
    }
}